﻿using System;
using System.Collections.Generic;
using System.Text;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Interactivity;
using Avalonia.Media;

namespace AvaloniaApplication1.Core
{
    /// <summary>
    /// 公共附加属性(定义一些附加属性 供公共调用)
    /// </summary>
    public  class ControlAttachProperty
    {
        #region FocusBackground 获得焦点背景色

        /// <summary>
        ///获得焦点背景色
        /// </summary>
        public static readonly AttachedProperty<IBrush> FocusBackgroundProperty = AvaloniaProperty.RegisterAttached<ControlAttachProperty, Interactive, IBrush>("FocusBackground");

        /// <summary>
        ///获得焦点背景色
        /// </summary>
        public static void SetFocusBackground(AvaloniaObject element, IBrush iBrush)
        {
            element.SetValue(FocusBackgroundProperty, iBrush);
        }
        public static IBrush GetFocusBackground(AvaloniaObject element)
        {
            return element.GetValue(FocusBackgroundProperty);
        }
        #endregion


        #region FocusForeground 获得焦点前景色，

        /// <summary>
        ///获得焦点前景色
        /// </summary>
        public static readonly AttachedProperty<IBrush> FocusForegroundProperty = AvaloniaProperty.RegisterAttached<ControlAttachProperty, Interactive, IBrush>("FocusForeground");

        /// <summary>
        ///获得焦点前景色
        /// </summary>
        public static void SetFocusForeground(AvaloniaObject element, IBrush iBrush)
        {
            element.SetValue(FocusForegroundProperty, iBrush);
        }
        public static IBrush GetFocusForeground(AvaloniaObject element)
        {
            return element.GetValue(FocusForegroundProperty);
        }


        #endregion

        #region MouseOverBackgroundProperty 鼠标悬浮背景色

        /// <summary>
        ///鼠标悬浮背景色
        /// </summary>
        public static readonly AttachedProperty<IBrush> MouseOverBackgroundProperty = AvaloniaProperty.RegisterAttached<ControlAttachProperty, Interactive, IBrush>("MouseOverBackground");

        /// <summary>
        ///鼠标悬浮背景色
        /// </summary>
        public static void SetMouseOverBackground(AvaloniaObject element, IBrush iBrush)
        {
            element.SetValue(MouseOverBackgroundProperty, iBrush);
        }
        public static IBrush GetMouseOverBackground(AvaloniaObject element)
        {
            return element.GetValue(MouseOverBackgroundProperty);
        }


        #endregion

        #region MouseOverForegroundProperty 鼠标悬浮前景色

        /// <summary>
        ///鼠标悬浮前景色
        /// </summary>
        public static readonly AttachedProperty<IBrush> MouseOverForegroundProperty = AvaloniaProperty.RegisterAttached<ControlAttachProperty, Interactive, IBrush>("MouseOverForeground");

        /// <summary>
        ///鼠标悬浮前景色
        /// </summary>
        public static void SetMouseOverForeground(AvaloniaObject element, IBrush iBrush)
        {
            element.SetValue(MouseOverForegroundProperty, iBrush);
        }
        public static IBrush GetMouseOverForeground(AvaloniaObject element)
        {
            return element.GetValue(MouseOverForegroundProperty);
        }


        #endregion

        #region FocusBorderBrush 焦点边框色，输入控件

        /// <summary>
        ///焦点边框色
        /// </summary>
        public static readonly AttachedProperty<IBrush> FocusBorderBrushProperty = AvaloniaProperty.RegisterAttached<ControlAttachProperty, Interactive, IBrush>("FocusBorderBrush");

        /// <summary>
        ///焦点边框色
        /// </summary>
        public static void SetFocusBorderBrush(AvaloniaObject element, IBrush iBrush)
        {
            element.SetValue(FocusBorderBrushProperty, iBrush);
        }
        public static IBrush GetFocusBorderBrush(AvaloniaObject element)
        {
            return element.GetValue(FocusBorderBrushProperty);
        }


        #endregion

        #region MouseOverBorderBrush 鼠标进入边框色，输入控件

        /// <summary>
        ///鼠标进入边框色
        /// </summary>
        public static readonly AttachedProperty<IBrush> MouseOverBorderBrushProperty = AvaloniaProperty.RegisterAttached<ControlAttachProperty, Interactive, IBrush>("MouseOverBorderBrush");

        /// <summary>
        ///鼠标进入边框色
        /// </summary>
        public static void SetMouseOverBorderBrush(AvaloniaObject element, IBrush iBrush)
        {
            element.SetValue(MouseOverBorderBrushProperty, iBrush);
        }


        //[AttachedPropertyBrowsableForType(typeof(TextBox))]
        //[AttachedPropertyBrowsableForType(typeof(CheckBox))]
        //[AttachedPropertyBrowsableForType(typeof(RadioButton))]
        //[AttachedPropertyBrowsableForType(typeof(DatePicker))]
        //[AttachedPropertyBrowsableForType(typeof(ComboBox))]
        //[AttachedPropertyBrowsableForType(typeof(RichTextBox))]
        public static IBrush GetMouseOverBorderBrush(AvaloniaObject element)
        {
            return element.GetValue(MouseOverBorderBrushProperty);
        }

        #endregion

        #region CornerRadiusProperty Border圆角
        /// <summary>
        ///Border圆角
        /// </summary>
        public static readonly AttachedProperty<CornerRadius> CornerRadiusProperty = AvaloniaProperty.RegisterAttached<ControlAttachProperty, Interactive, CornerRadius>("CornerRadius");

        /// <summary>
        ///Border圆角
        /// </summary>
        public static void SetCornerRadius(AvaloniaObject element, CornerRadius cornerRadius)
        {
            element.SetValue(CornerRadiusProperty, cornerRadius);
        }
        public static CornerRadius GetCornerRadius(AvaloniaObject element)
        {
            return element.GetValue(CornerRadiusProperty);
        }

        #endregion

        #region TextTrimming文本裁剪
        /// <summary>
        ///文本裁剪
        /// </summary>
        public static readonly AttachedProperty<TextTrimming> TextTrimmingProperty = AvaloniaProperty.RegisterAttached<ControlAttachProperty, Interactive, TextTrimming>("TextTrimming");

        /// <summary>
        ///文本裁剪
        /// </summary>
        public static void SetTextTrimming(AvaloniaObject element, TextTrimming textTrimming)
        {
            element.SetValue(TextTrimmingProperty, textTrimming);
        }
        public static TextTrimming GetTextTrimming(AvaloniaObject element)
        {
            return element.GetValue(TextTrimmingProperty);
        }
        #endregion

        ///// <summary>
        /////文本裁剪
        ///// </summary>
        //public static readonly AttachedProperty<string> TestProperty = AvaloniaProperty.RegisterAttached<string>("Test");

        ///// <summary>
        /////文本裁剪
        ///// </summary>
        //public static void SetTest(AvaloniaObject element, string stringValue)
        //{
        //    element.SetValue(TestProperty, stringValue);
        //}
        //public static string GetTest(AvaloniaObject element)
        //{
        //    return element.GetValue(TestProperty);
        //}



    }
}
